package com.xique.door.biz.service.impl;

import com.xique.common.core.utils.OrikaUtil;
import com.xique.common.core.web.domain.AjaxResult;
import com.xique.door.bean.domain.BuildHouseUser;
import com.xique.door.bean.vo.user.HouseUserListVO;
import com.xique.door.biz.service.IHouseUserBizService;
import com.xique.door.service.IBuildHouseUserService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shd
 * @create 2022/3/8 17:00
 */
@Service
public class HouseUserBizServiceImpl implements IHouseUserBizService {

    @Autowired
    private IBuildHouseUserService houseUserService;

    @Override
    public AjaxResult getHouseUserList(Long houseId) {
        List<BuildHouseUser> list = houseUserService.selectHouseUserList(houseId);
        if (CollectionUtils.isEmpty(list)) {
            return AjaxResult.success();
        }
        List<HouseUserListVO> vos = OrikaUtil.converts(list, HouseUserListVO.class);
        return AjaxResult.success(vos);
    }
}
